def Avg():
    avg = 0
    total = 0
    count = 0
    while True:
        res = yield avg
        count += 1
        total += res
        avg = total/count

def main():
    x = Avg()
    next(x)
    print(x.send(7))
    print(x.send(9))
    print(x.send(3))
    x.close()

main()